package com.song.config;

import com.song.interceptor.MyInterCeptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @ClassName : MyConfig
 * @Author : 司猫子
 * @Date: 2021/3/1 11:12
 */
@Configuration
public class MyConfig implements WebMvcConfigurer {
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        String[] addPath = new String[]{"/hi/**"};
        String[] excludPath = {"/hi/to2"};
        MyInterCeptor myInterCeptor = new MyInterCeptor();
        registry.addInterceptor(myInterCeptor).addPathPatterns(addPath)
                .excludePathPatterns(excludPath);

    }
}
